package day6;

public class Cylinder extends Circle{
    private double height;

    public Cylinder(double radius, double height) {
        super(radius);
        this.height = height;
    }

    // 表面积
    public double area() {
        return this.area() * 2 + this.perimeter() * this.height;
    }

    // 体积
    public double volume() {
        return 3.14 * getRadius() * getRadius() * height;
    }

    @Override
    public String toString() {
        return "Cylinder{" +
                "height=" + height +
                '}';
    }
}
